package test

import (
	"context"
	"sale-admin/internal/app/grpc/protoc/sale_adminc"
	"sale-admin/internal/pkg/points"

	"gorm.io/gorm"
)

type TestService struct{}

// 获取机器对接的积分系统信息
func (t TestService) WanxiangQueryPoints(ctx context.Context, db *gorm.DB) (res sale_adminc.GetWanXiangMemberRsp, err error) {

	openid := "o3s8k7WVzRG12xtiabCEIZHNl6uw"
	mallcode := "2XRY00201"

	data, err := points.NewPoints("5").PointsQuery(ctx, "", openid, mallcode)
	if err != nil {
		res.Code = 100099
		res.Msg = "当前用户未注册"
		return
	}
	res.Data = &sale_adminc.GetWanXiangMemberRsp_Data{
		NickName: "",
		Points:   float32(data),
		HeadImg:  "",
		Phone:    "",
		Id:       "",
		CardNo:   "",
	}

	return
}
